<template>
  <el-button 
    v-show="!circle" 
    :type="type" 
    :round="round" 
    :disabled="disabled" 
    :color="color"
    @click="handleBtnClick"
  >
    <el-icon v-show="icon" style="margin-right:6px">
      <component :is="icon" />
    </el-icon>
    {{text}}
  </el-button>
  <el-button v-show="circle" :type="type" circle :disabled="disabled" :color="color" />
</template>

<script setup>
// eslint-disable-next-line no-undef
const emits = defineEmits(['btnClick'])
// eslint-disable-next-line
defineProps({
  type: {
    type: String,
    default: 'primary'
  },
  text: {
    type: String,
    default: '文字'
  },
  icon: {
    type: [String, Object],
    default: 'el-icon-edit'
  },
  color: {
    type: String,
    default: ''
  },
  circle: {
    type: Boolean,
    default: false
  },
  round: {
    type: Boolean,
    default: false
  },
  disabled: {
    type: Boolean,
    default: false
  }
})

function handleBtnClick() {
  emits('btnClick')
}
</script>
